|
|
|
|
|
|
|
LocalErr:
BBInit = Err.Number
'
End Function |
|
|
|
|
|
|
|
|
Listing 10.17 uses the data form's dimensions to calculate the location and size of the command buttons in the button set. You create a working example of this form in the section ''Creating a Data Entry Form with the Library Routines." |
|
|
|
|
|
|
|
|
The BBEnable routine is a short routine that allows you to toggle the Enabled property of the command buttons in the button set. This routine is used to turn on or off selected buttons during edit or add operations. Add the routine in Listing 10.18 to the library. |
|
|
|
|
|
|
|
|
Listing 10.18. Coding the BBEnable routine. |
|
|
|
|
|
|
|
|
Public Function BBEnable(frmTemp As Object, strList As String)
'
' enable buttons
'
On Error GoTo LocalErr
'
Dim intLoop As Integer
'
strList = Trim(strList)
'
For intLoop = 1 To Len(strList)
If Mid(strList, intLoop, 1) = "1" Then
frmTemp.cmdbtn(intLoop - 1).Enabled = True
Else
frmTemp.cmdbtn(intLoop - 1).Enabled = False
End If
Next
'
BBEnable = 0
Exit Function
'
LocalErr:
BBEnable = Err.Number
'
End Function |
|
|
|
|
|
|
|
|
The routine works by accepting a series of eight 1s and 0s. Each position in the eight-byte string represents one of the button bar buttons. If the value is set to 1, the button is enabled. If the value is set to 0, the button is disabled. |
|
|
|
|
|